package acwing_01;
import java.util.*;
import java.io.*;
public class _801_二进制中1的个数_lowbit {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	static int N = 100010;
	static int n;
	static StringTokenizer st;
	public static int lowbit(int x) {
		return x & -x;
	}
	public static void main(String[] args) throws IOException{
		n = Integer.parseInt(br.readLine());
		st = new StringTokenizer(br.readLine());
		for(int i = 0; i < n; i++) {
			int x = Integer.parseInt(st.nextToken());
			int count = 0;
			while (x != 0) {
				/* 
				 * lowbit
				 * x & -x 会返回x最后一位1的值，比如1100，会返回100，100的值是4
				 * 由于返回的是最后一位1的值，那就需要减掉这个1的值
				 * 减了一位1说明原来有一个1，那么统计1的count就++
				 * 不断减直到x=0说明没有1了
				*/ 
				x -= lowbit(x);
				count++;
			}
			bw.write(count + " ");
		}

		bw.flush();
		bw.close();
		br.close();


	}
}
